Ext.define('NF.controller.LivestockMasterDetails',{
    extend:'Ext.app.Controller',
    views:['farm.LivestockInfo','farm.LivestockDetails','farm.LactationDetails',
            'farm.FeedDetails','farm.ExpenseDetails','farm.RevenueDetails',
            'farm.CheckupDetails','farm.CalveDetails','farm.MedicalHistoryDetails',
            'farm.CreateLivestock','farm.LivestockSearchPanel','farm.LivestockSearchForm'],
    stores:['Gender','Farms','LivestockStatusType'],
    models:['LactationDetails','FeedDetails','FeedTypes','ExpenseDetails','CheckupDetails','Person','CheckupType',
            'Disease','VaccineType','Gender','Farm','FarmLivestockList','LivestockStatusType'],
    init:function(){
         this.control({
            'viewport > farmTabs > livestockMasterDetails > livestockDetails':{tabchange:this.createLivestock}
        })
    },
    createLivestock:function(tabPanel,  newCard, oldCard, options ){
        if(!newCard.activatedAtleastOnce){
           newCard.prepareGrid();
           newCard.activatedAtleastOnce = true;
        }else{
            console.log(newCard.getId() + "already activated");
        }
    }
});